Set path Laura: ONLY USE FOR LAURA

# base_path <- "//home.kt.ktzh.ch/B117T23$/Desktop/Riskktaking/Data"
base_path <- "/Users/laurabazzigher/Documents/GitHub/risk_wvs/data/dataset/Data_S3"

Library

library(tidyverse)
library(ggplot2)
library(specr)
library(specr)
library(readxl)
library(ggthemes)
library(cowplot)
library(dplyr)
library(knitr)
library(kableExtra)
library(Hmisc)
remotes::install_github("masurp/specr")

Load all data

# Combined GPS WVS
risktaking <- read.csv(file.path(base_path, "gps_wvs_combined.csv"), header=TRUE, as.is=TRUE)

# Umbenennen von 'isocode' zu 'COUNTRY' in risktaking
risktaking <- risktaking %>%
  rename(COUNTRY = isocode)

risktaking <- risktaking %>%
  select(-hardship_index, -worldmap, -source)

hardship_hs <- read.csv(file.path(base_path, "hardship_HS.csv"))
hardship_finance <- read.csv(file.path(base_path, "hardship_finance.csv"))
hardship_crime <- read.csv(file.path(base_path, "hardship_crime.csv"))
hardship_environment <- read.csv(file.path(base_path, "hardship_environment.csv"))

# Entfernen der nicht benötigten Spalten aus den Datensätzen vor dem Zusammenführen
hardship_hs <- hardship_hs %>%
  select(-country, -avg_risktaking)
hardship_finance <- hardship_finance %>%
  select(-country, -avg_risktaking)
hardship_crime <- hardship_crime %>%
  select(-country, -avg_risktaking)
hardship_environment <- hardship_environment %>%
  select(-country, -avg_risktaking)

# Zusammenführen der Datensätze
hardship_combined <- risktaking %>%
  left_join(hardship_hs, by = "COUNTRY") %>%
  left_join(hardship_finance, by = "COUNTRY") %>%
  left_join(hardship_crime, by = "COUNTRY") %>%
  left_join(hardship_environment, by = "COUNTRY")

# Überprüfung der Struktur des kombinierten Datensatzes
#str(hardship_combined)
# Stellen Sie sicher, dass die Alterskategorien richtig zugewiesen wurden
if (!"age_category" %in% names(hardship_combined)) {
  hardship_combined$age_category <- cut(hardship_combined$age,
                                        breaks = c(15, 24, 34, 44, 54, 64, 74, 84, 99),
                                        labels = c("Youth (15-24)", 
                                                   "Young Adults (25-34)", 
                                                   "Middle-aged Adults (35-44)", 
                                                   "Mature Adults (45-54)",
                                                   "Pre-seniors (55-64)",
                                                   "Early Seniors (65-74)",
                                                   "Seniors (75-84)",
                                                   "Elderly (85-99)"),
                                        right = TRUE, include.lowest = TRUE)
}

# Umwandlung der Alterskategorien in numerische Werte
hardship_combined$age_numeric <- as.integer(factor(hardship_combined$age_category))

# Überprüfung der neuen numerischen Alterskategorien
table(hardship_combined$age_numeric)
## 
##     1     2     3     4     5     6     7     8 
## 17776  1119 37511 44658 28953  7335 51013 40700

Calculate correlation with risktaking

# Berechnung der Korrelation zwischen risktaking und den anderen Variablen
correlation_results <- cor(hardship_combined[, sapply(hardship_combined, is.numeric)], use = "complete.obs")

# Korrelationstabelle für risktaking extrahieren
risktaking_correlations <- correlation_results["risktaking", ]

# Konvertierung der Korrelationsergebnisse in ein formatiertes Datenframe
correlation_table <- data.frame(
  Variable = names(risktaking_correlations),
  Correlation = risktaking_correlations
)

# Entfernen der Korrelation von risktaking mit sich selbst
correlation_table <- correlation_table[correlation_table$Variable != "risktaking", ]

# Sortieren der Ergebnisse nach dem Betrag der Korrelation, absteigend
correlation_table <- correlation_table[order(-abs(correlation_table$Correlation)), ]

# Anzeigen der Tabelle
kable(correlation_table, caption = "Korrelationen zwischen risktaking und anderen Variablen") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
Korrelationen zwischen risktaking und anderen Variablen
Variable Correlation
age age -0.2381263
age_numeric age_numeric 0.1837615
hardship_Finance_index hardship_Finance_index 0.1255989
HS_original_lifeexpectancy HS_original_lifeexpectancy 0.1244475
hardship_environment_index hardship_environment_index 0.1228625
gender gender -0.1201418
e_exp_watersanithyg100k e_exp_watersanithyg100k 0.1159198
f_original_gini f_original_gini 0.1127801
hardship_HS_index hardship_HS_index 0.1122306
hardship_Crime_index hardship_Crime_index 0.1043428
e_exp_airdeath100k e_exp_airdeath100k 0.1020337
e_oth_drinkingwater e_oth_drinkingwater 0.0974426
HS_oth_cleancooking HS_oth_cleancooking 0.0967826
f_original_gdp f_original_gdp 0.0955940
c_bh_violextchildprot c_bh_violextchildprot 0.0936960
e_exp_watersanithyg e_exp_watersanithyg 0.0926370
e_ses_gini e_ses_gini 0.0913668
c_bh_childmalt c_bh_childmalt 0.0876729
HS_alc_tax_wine HS_alc_tax_wine 0.0867029
c_bh_homicide c_bh_homicide 0.0814154
c_bh_elderabuse c_bh_elderabuse 0.0796172
HS_drg_treatment HS_drg_treatment 0.0779335
f_hs_oopexp10 f_hs_oopexp10 0.0754779
f_eco_cpi f_eco_cpi 0.0751496
c_oth_polstab c_oth_polstab 0.0744124
HS_sex_gini HS_sex_gini 0.0728827
f_eco_gdpdefl_linked f_eco_gdpdefl_linked 0.0726808
HS_alc_roaddeath HS_alc_roaddeath 0.0699059
HS_nic_affordability HS_nic_affordability 0.0641391
c_theft_estcorruption c_theft_estcorruption 0.0559263
f_oth_insfinsvcs_int f_oth_insfinsvcs_int 0.0538295
HS_original_genderequality HS_original_genderequality 0.0496918
HS_sex_antiretroviral HS_sex_antiretroviral 0.0495593
e_ses_school e_ses_school 0.0468552
c_bh_parviolenceprog c_bh_parviolenceprog 0.0421859
HS_oth_obesity HS_oth_obesity 0.0363355
HS_mh_mhhospit HS_mh_mhhospit 0.0209093
HS_mh_policy HS_mh_policy -0.0149841
f_inv_acctownership_primaryedu f_inv_acctownership_primaryedu 0.0114821
e_exp_disaster e_exp_disaster 0.0013854

Table with Correlation hardship factors and risktaking

# Laden notwendiger Bibliotheken
library(Hmisc)
library(kableExtra)

# Auswahl aller numerischen Variablen
numeric_vars <- hardship_combined %>%
  select(where(is.numeric))

# Berechnen der Korrelationsmatrix und der p-Werte
cor_results <- rcorr(as.matrix(numeric_vars))

# Korrelationen und p-Werte spezifisch für 'risktaking' extrahieren
correlations <- cor_results$r[, "risktaking"]  # Korrelationen zu 'risktaking'
p_values <- cor_results$P[, "risktaking"]      # p-Werte zu 'risktaking'

# Datenrahmen für die Darstellung erstellen
cor_table <- data.frame(
  Variable = rownames(cor_results$r),  # Namen der Variablen
  Correlation = round(correlations, 5),  # Korrelationswerte, gerundet auf 5 Dezimalstellen
  P_value = format(p_values, scientific = TRUE),  # p-Werte in wissenschaftlicher Notation
  Significant = ifelse(p_values < 0.05, "Yes", "No")  # Signifikanzflag, basierend auf p-Wert
)

# Tabellendarstellung mit 'kable' und 'kableExtra'
cor_table %>%
  kable("html", caption = "Correlations with Risktaking: Summary of Results") %>%
  kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
  column_spec(2, bold = TRUE) %>%
  column_spec(3, background = "lightyellow")
Correlations with Risktaking: Summary of Results
Variable Correlation P_value Significant
gender gender -0.11984 0.000000e+00 Yes
age age -0.24184 0.000000e+00 Yes
risktaking risktaking 1.00000 NA NA
HS_alc_tax_wine HS_alc_tax_wine 0.08408 0.000000e+00 Yes
HS_alc_roaddeath HS_alc_roaddeath 0.07748 0.000000e+00 Yes
HS_drg_treatment HS_drg_treatment 0.07606 0.000000e+00 Yes
HS_nic_affordability HS_nic_affordability 0.07479 0.000000e+00 Yes
HS_mh_policy HS_mh_policy -0.00730 5.432256e-04 Yes
HS_sex_gini HS_sex_gini 0.08042 0.000000e+00 Yes
HS_oth_obesity HS_oth_obesity 0.01722 4.440892e-16 Yes
HS_oth_cleancooking HS_oth_cleancooking 0.10040 0.000000e+00 Yes
HS_mh_mhhospit HS_mh_mhhospit 0.03081 0.000000e+00 Yes
HS_sex_antiretroviral HS_sex_antiretroviral 0.05036 0.000000e+00 Yes
HS_original_lifeexpectancy HS_original_lifeexpectancy 0.13508 0.000000e+00 Yes
HS_original_genderequality HS_original_genderequality 0.05193 0.000000e+00 Yes
hardship_HS_index hardship_HS_index 0.11857 0.000000e+00 Yes
f_inv_acctownership_primaryedu f_inv_acctownership_primaryedu 0.02165 0.000000e+00 Yes
f_oth_insfinsvcs_int f_oth_insfinsvcs_int 0.05273 0.000000e+00 Yes
f_hs_oopexp10 f_hs_oopexp10 0.07968 0.000000e+00 Yes
f_eco_gdpdefl_linked f_eco_gdpdefl_linked 0.07069 0.000000e+00 Yes
f_eco_cpi f_eco_cpi 0.10108 0.000000e+00 Yes
f_original_gdp f_original_gdp 0.10264 0.000000e+00 Yes
f_original_gini f_original_gini 0.11561 0.000000e+00 Yes
hardship_Finance_index hardship_Finance_index 0.13907 0.000000e+00 Yes
c_bh_homicide c_bh_homicide 0.09742 0.000000e+00 Yes
c_bh_childmalt c_bh_childmalt 0.09575 0.000000e+00 Yes
c_bh_violextchildprot c_bh_violextchildprot 0.09740 0.000000e+00 Yes
c_bh_parviolenceprog c_bh_parviolenceprog 0.04102 0.000000e+00 Yes
c_bh_elderabuse c_bh_elderabuse 0.08784 0.000000e+00 Yes
c_theft_estcorruption c_theft_estcorruption 0.06759 0.000000e+00 Yes
c_oth_polstab c_oth_polstab 0.08484 0.000000e+00 Yes
hardship_Crime_index hardship_Crime_index 0.11775 0.000000e+00 Yes
e_oth_drinkingwater e_oth_drinkingwater 0.10202 0.000000e+00 Yes
e_exp_watersanithyg100k e_exp_watersanithyg100k 0.12385 0.000000e+00 Yes
e_ses_gini e_ses_gini 0.09615 0.000000e+00 Yes
e_ses_school e_ses_school 0.04925 0.000000e+00 Yes
e_exp_disaster e_exp_disaster -0.00702 8.810206e-04 Yes
e_exp_airdeath100k e_exp_airdeath100k 0.11396 0.000000e+00 Yes
e_exp_watersanithyg e_exp_watersanithyg 0.09110 0.000000e+00 Yes
hardship_environment_index hardship_environment_index 0.12948 0.000000e+00 Yes
age_numeric age_numeric 0.18754 0.000000e+00 Yes
colnames(hardship_combined)
##  [1] "country"                        "COUNTRY"                       
##  [3] "gender"                         "age"                           
##  [5] "risktaking"                     "age_category"                  
##  [7] "HS_alc_tax_wine"                "HS_alc_roaddeath"              
##  [9] "HS_drg_treatment"               "HS_nic_affordability"          
## [11] "HS_mh_policy"                   "HS_sex_gini"                   
## [13] "HS_oth_obesity"                 "HS_oth_cleancooking"           
## [15] "HS_mh_mhhospit"                 "HS_sex_antiretroviral"         
## [17] "HS_original_lifeexpectancy"     "HS_original_genderequality"    
## [19] "hardship_HS_index"              "f_inv_acctownership_primaryedu"
## [21] "f_oth_insfinsvcs_int"           "f_hs_oopexp10"                 
## [23] "f_eco_gdpdefl_linked"           "f_eco_cpi"                     
## [25] "f_original_gdp"                 "f_original_gini"               
## [27] "hardship_Finance_index"         "c_bh_homicide"                 
## [29] "c_bh_childmalt"                 "c_bh_violextchildprot"         
## [31] "c_bh_parviolenceprog"           "c_bh_elderabuse"               
## [33] "c_theft_estcorruption"          "c_oth_polstab"                 
## [35] "hardship_Crime_index"           "e_oth_drinkingwater"           
## [37] "e_exp_watersanithyg100k"        "e_ses_gini"                    
## [39] "e_ses_school"                   "e_exp_disaster"                
## [41] "e_exp_airdeath100k"             "e_exp_watersanithyg"           
## [43] "hardship_environment_index"     "age_numeric"

Setup for specifications

library(specr)

# Setup für die Spezifikationen mit einer umfassenderen Auswahl von Variablen
specification <- setup(
  data = hardship_combined,
  y = "risktaking",  # abhängige Variable
  x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
        "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
        "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
        "HS_mh_mhhospit", "HS_sex_antiretroviral",
        "HS_original_lifeexpectancy", "HS_original_genderequality",
        "hardship_HS_index", "f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
        "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
        "f_original_gdp", "f_original_gini", "hardship_Finance_index",
        "c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
        "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
        "c_oth_polstab", "hardship_Crime_index", "e_oth_drinkingwater",
        "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
        "e_exp_airdeath100k", "e_exp_watersanithyg"),
  model = "lm"
)

# Zusammenfassung der Spezifikationen
summary(specification)
## Setup for the Specification Curve Analysis
## -------------------------------------------
## Class:                      specr.setup -- version: 1.0.1 
## Number of specifications:   36 
## 
## Specifications:
## 
##   Independent variable:     HS_alc_tax_wine, HS_alc_roaddeath, HS_drg_treatment, HS_nic_affordability, HS_mh_policy, HS_sex_gini, HS_oth_obesity, HS_oth_cleancooking, HS_mh_mhhospit, HS_sex_antiretroviral, HS_original_lifeexpectancy, HS_original_genderequality, hardship_HS_index, f_inv_acctownership_primaryedu, f_oth_insfinsvcs_int, f_hs_oopexp10, f_eco_gdpdefl_linked, f_eco_cpi, f_original_gdp, f_original_gini, hardship_Finance_index, c_bh_homicide, c_bh_childmalt, c_bh_violextchildprot, c_bh_parviolenceprog, c_bh_elderabuse, c_theft_estcorruption, c_oth_polstab, hardship_Crime_index, e_oth_drinkingwater, e_exp_watersanithyg100k, e_ses_gini, e_ses_school, e_exp_disaster, e_exp_airdeath100k, e_exp_watersanithyg 
##   Dependent variable:       risktaking 
##   Models:                   lm 
##   Covariates:               no covariates 
##   Subsets analyses:         all 
## 
## Function used to extract parameters:
## 
##   function (x) 
## broom::tidy(x, conf.int = TRUE)
## <environment: 0x138dc4320>
## 
## 
## Head of specifications table (first 6 rows):
## # A tibble: 6 × 6
##   x                    y          model controls      subsets formula           
##   <chr>                <chr>      <chr> <chr>         <chr>   <glue>            
## 1 HS_alc_tax_wine      risktaking lm    no covariates all     risktaking ~ HS_a…
## 2 HS_alc_roaddeath     risktaking lm    no covariates all     risktaking ~ HS_a…
## 3 HS_drg_treatment     risktaking lm    no covariates all     risktaking ~ HS_d…
## 4 HS_nic_affordability risktaking lm    no covariates all     risktaking ~ HS_n…
## 5 HS_mh_policy         risktaking lm    no covariates all     risktaking ~ HS_m…
## 6 HS_sex_gini          risktaking lm    no covariates all     risktaking ~ HS_s…

run specifications

specification_results <- specr(specification)
specification_results
## Models fitted based on 36 specifications
## Number of cores used: 1 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25 q75
##     0.9 0.32 -0.17 2.46 0.67 1.1
summary(specification_results, digits = 5)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    5.969 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.89992 0.32447 -0.16974 2.46013 0.66647 1.09621
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  224583 221536 225551
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.917    0.0229     40.0 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.853    0.0232     36.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.784    0.0217     36.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.806    0.0227     35.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.170    0.0491     -3.46
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.837    0.0219     38.2 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

summarizing the parameter distribution

summary(specification_results, type = "curve")
## # A tibble: 1 × 7
##   median   mad    min   max   q25   q75    obs
##    <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1  0.900 0.324 -0.170  2.46 0.666  1.10 224583
summary(specification_results, 
        type = "curve", 
        group = "x",           
        stats = c("median", "mean", "min", "max"))  # Statistiken in einem Vektor auflisten
## # A tibble: 36 × 6
##    x                          median   mean    min    max    obs
##    <chr>                       <dbl>  <dbl>  <dbl>  <dbl>  <int>
##  1 HS_alc_roaddeath            0.853  0.853  0.853  0.853 224583
##  2 HS_alc_tax_wine             0.917  0.917  0.917  0.917 224583
##  3 HS_drg_treatment            0.784  0.784  0.784  0.784 224583
##  4 HS_mh_mhhospit              0.327  0.327  0.327  0.327 224583
##  5 HS_mh_policy               -0.170 -0.170 -0.170 -0.170 224583
##  6 HS_nic_affordability        0.806  0.806  0.806  0.806 224583
##  7 HS_original_genderequality  0.677  0.677  0.677  0.677 224583
##  8 HS_original_lifeexpectancy  1.40   1.40   1.40   1.40  224583
##  9 HS_oth_cleancooking         1.09   1.09   1.09   1.09  224583
## 10 HS_oth_obesity              0.169  0.169  0.169  0.169 224583
## # ℹ 26 more rows

Plots

plot(specification_results)

(a <- plot(specification_results, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b <- plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c <- plot(specification_results, type = "samplesizes") + ylim(0, 400))

plot_grid(a, b, c, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for males

specification_males <- setup(
  data = hardship_combined %>%
           filter(gender == 1),  # Filter for males
  y = "risktaking",
  x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
        "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
        "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
        "HS_mh_mhhospit", "HS_sex_antiretroviral",
        "HS_original_lifeexpectancy", "HS_original_genderequality",
        "hardship_HS_index", "f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
        "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
        "f_original_gdp", "f_original_gini", "hardship_Finance_index",
        "c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
        "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
        "c_oth_polstab", "hardship_Crime_index", "e_oth_drinkingwater",
        "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
        "e_exp_airdeath100k", "e_exp_watersanithyg"),
  model = "lm"
)

# Run the specifications for males
specification_results_males <- specr(specification_males)

# View the summary of the results
summary(specification_results_males)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    2.945 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min max  q25  q75
##    0.99 0.38 -0.11 2.8 0.74 1.21
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  119096 117485 119591
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…     0.93      0.03      29.5
## 2 HS_alc_road… risk… lm    no cova… all     riskta…     1         0.03      31.2
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…     0.83      0.03      28.6
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…     0.94      0.03      30.0
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    -0.11      0.07      -1.7
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…     0.97      0.03      32.4
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for male subset results

plot(specification_results_males)

(a_male <- plot(specification_results_males, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_male <- plot(specification_results_males, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_male <- plot(specification_results_males, type = "samplesizes") + ylim(0, 400))

plot_grid(a_male, b_male, c_male, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_males, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for females

specification_females <- setup(
  data = hardship_combined %>%
           filter(gender == 0),  # Filter for females
  y = "risktaking",
  x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
        "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
        "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
        "HS_mh_mhhospit", "HS_sex_antiretroviral",
        "HS_original_lifeexpectancy", "HS_original_genderequality",
        "hardship_HS_index", "f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
        "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
        "f_original_gdp", "f_original_gini", "hardship_Finance_index",
        "c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
        "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
        "c_oth_polstab", "hardship_Crime_index", "e_oth_drinkingwater",
        "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
        "e_exp_airdeath100k", "e_exp_watersanithyg"),
  model = "lm"
)

# Run the specifications for females
specification_results_females <- specr(specification_females)

# View the summary of the results
summary(specification_results_females)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    2.722 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    0.71 0.31 -0.26 2.04 0.52 0.93
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  105487 104051 105960
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…     0.84      0.03     25.4 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…     0.69      0.03     20.9 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…     0.7       0.03     21.8 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…     0.61      0.03     18.9 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    -0.26      0.07     -3.72
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…     0.63      0.03     20.0 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for female subset results

plot(specification_results_females)

(a_female <- plot(specification_results_females, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_female <- plot(specification_results_females, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_female <- plot(specification_results_females, type = "samplesizes") + ylim(0, 400))

plot_grid(a_female, b_female, c_female, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_females, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for age-categories

run_specification_for_age <- function(data, age_id, age_label) {
  # Daten für die spezifische Altersgruppe filtern
  data_subset <- data %>%
    filter(age_numeric == age_id)
  
  # Setup für die Spezifikationen durchführen
  specification <- setup(
    data = data_subset,
    y = "risktaking",
    x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
          "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
          "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
          "HS_mh_mhhospit", "HS_sex_antiretroviral",
          "HS_original_lifeexpectancy", "HS_original_genderequality",
          "hardship_HS_index", "f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
          "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
          "f_original_gdp", "f_original_gini", "hardship_Finance_index",
          "c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
          "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
          "c_oth_polstab", "hardship_Crime_index", "e_oth_drinkingwater",
          "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
          "e_exp_airdeath100k", "e_exp_watersanithyg"),
    model = "lm"
  )

  # Spezifikationsergebnisse berechnen
  specification_results <- specr(specification)

  # Statistische Auswertungen drucken mit Alterskategorie-Titel
  cat("\nStatistische Ergebnisse für die Alterskategorie:", age_label, "\n")
  print(summary(specification_results, digits = 5))

  # Grafiken für die spezifische Altersgruppe erzeugen und anzeigen
  plot_list <- list(
    plot_a = plot(specification_results, type = "curve", ci = FALSE, ribbon = TRUE) + 
             geom_point(size = 4) + ggtitle(paste("Curve Plot -", age_label)),
    plot_b = plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) + 
             geom_point(size = 2, shape = 4) + ggtitle(paste("Choices Plot -", age_label)),
    plot_c = plot(specification_results, type = "samplesizes") + ylim(0, 400) +
             ggtitle(paste("Sample Sizes Plot -", age_label)),
    plot_d = plot(specification_results, type = "boxplot") + 
             geom_point(alpha = .4) + scale_fill_brewer(palette = "Pastel2") + 
             labs(x = "Effect size", fill = "") + ggtitle(paste("Boxplot -", age_label))
  )

  # Rückgabe der Ergebnisse und Plots
  return(list(summary = summary(specification_results, digits = 5), plots = plot_list))
}

# Funktion für jede Altersgruppe aufrufen und sowohl statistische Zusammenfassungen als auch Plots ausgeben
for (i in 1:8) {
  results <- run_specification_for_age(hardship_combined, i, paste("Age Group", i))
  print(results$summary)  # Drucke die Zusammenfassung der Ergebnisse
  print(results$plots$plot_a)
  print(results$plots$plot_b)
  print(results$plots$plot_c)
  print(results$plots$plot_d)
}
## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 1 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.453 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.82553 0.51379 0.06936 2.82099 0.39879 1.02854
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17485 16909 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.912    0.0777     11.7 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.02     0.0982     10.4 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.849    0.0765     11.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.896    0.0932      9.62
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.292    0.171       1.70
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.980    0.0825     11.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.453 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.82553 0.51379 0.06936 2.82099 0.39879 1.02854
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17485 16909 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.912    0.0777     11.7 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.02     0.0982     10.4 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.849    0.0765     11.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.896    0.0932      9.62
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.292    0.171       1.70
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.980    0.0825     11.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 2 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.145 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad     min     max     q25     q75
##   1.002 0.73912 0.16285 3.96158 0.54212 1.54371
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1109 1098 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.549     0.304      1.81
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.586     0.438      1.34
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    1.21      0.332      3.65
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    1.40      0.394      3.56
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.879     0.677      1.30
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    1.51      0.333      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.145 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad     min     max     q25     q75
##   1.002 0.73912 0.16285 3.96158 0.54212 1.54371
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1109 1098 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.549     0.304      1.81
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.586     0.438      1.34
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    1.21      0.332      3.65
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    1.40      0.394      3.56
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.879     0.677      1.30
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    1.51      0.333      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 3 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.986 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  0.62911 0.28999 -0.263 1.74192 0.32607 0.74046
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36643 36047 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.686    0.0562     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.667    0.0608     11.0 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.604    0.0527     11.5 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.611    0.0578     10.6 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.121    0.119       1.02
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.493    0.0544      9.07
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.986 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  0.62911 0.28999 -0.263 1.74192 0.32607 0.74046
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36643 36047 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.686    0.0562     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.667    0.0608     11.0 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.604    0.0527     11.5 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.611    0.0578     10.6 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.121    0.119       1.02
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.493    0.0544      9.07
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 4 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.039 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad      min  max     q25     q75
##  0.6992 0.31182 -0.26951 1.87 0.39867 0.82467
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43739 43230 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.709    0.0509     13.9 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.782    0.0516     15.2 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.623    0.0483     12.9 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.616    0.0494     12.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.161    0.108      -1.49
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.447    0.0492      9.09
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.039 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad      min  max     q25     q75
##  0.6992 0.31182 -0.26951 1.87 0.39867 0.82467
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43739 43230 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.709    0.0509     13.9 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.782    0.0516     15.2 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.623    0.0483     12.9 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.616    0.0494     12.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.161    0.108      -1.49
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.447    0.0492      9.09
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 5 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.658 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25    q75
##  0.77887 0.34704 -0.06869 2.55015 0.56418 1.0168
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28345 27546 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.782    0.0641     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.04     0.0750     13.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.699    0.0597     11.7 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.854    0.0697     12.3 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.278    0.136       2.05
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.742    0.0632     11.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.658 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25    q75
##  0.77887 0.34704 -0.06869 2.55015 0.56418 1.0168
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28345 27546 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.782    0.0641     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.04     0.0750     13.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.699    0.0597     11.7 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.854    0.0697     12.3 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.278    0.136       2.05
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.742    0.0632     11.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 6 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.265 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad      min     max     q25    q75
##  0.94319 0.5109 -0.18088 3.61082 0.60599 1.2869
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7198 6951 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…  0.957       0.120   7.96   
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  0.901       0.162   5.55   
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…  0.934       0.117   7.96   
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  0.952       0.155   6.13   
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  0.00237     0.259   0.00915
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  1.42        0.136  10.5    
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.265 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad      min     max     q25    q75
##  0.94319 0.5109 -0.18088 3.61082 0.60599 1.2869
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7198 6951 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…  0.957       0.120   7.96   
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  0.901       0.162   5.55   
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…  0.934       0.117   7.96   
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  0.952       0.155   6.13   
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  0.00237     0.259   0.00915
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  1.42        0.136  10.5    
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 7 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.133 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min   max     q25     q75
##  0.55414 0.33273 -0.62666 1.678 0.17235 0.74247
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50053 49763 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.394     0.0479     8.22 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…   0.596     0.0440    13.6  
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.460     0.0452    10.2  
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…   0.422     0.0440     9.58 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -0.627     0.101     -6.20 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…   0.0164    0.0457     0.358
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.133 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min   max     q25     q75
##  0.55414 0.33273 -0.62666 1.678 0.17235 0.74247
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50053 49763 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.394     0.0479     8.22 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…   0.596     0.0440    13.6  
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.460     0.0452    10.2  
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…   0.422     0.0440     9.58 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -0.627     0.101     -6.20 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…   0.0164    0.0457     0.358
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 8 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.892 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max      q25     q75
##  -0.09126 0.34031 -1.21618 0.68027 -0.32629 0.08934
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40131 39992 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.380     0.0533      7.13
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  -0.0688    0.0474     -1.45
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.137     0.0492      2.79
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  -0.322     0.0497     -6.47
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -1.22      0.112     -10.9 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  -0.541     0.0512    -10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.892 sec elapsed 
##   Number of specifications:       36 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max      q25     q75
##  -0.09126 0.34031 -1.21618 0.68027 -0.32629 0.08934
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40131 39992 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.380     0.0533      7.13
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  -0.0688    0.0474     -1.45
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.137     0.0492      2.79
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  -0.322     0.0497     -6.47
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -1.22      0.112     -10.9 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  -0.541     0.0512    -10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

Hardship Health/Safety

Setup for specifications

library(specr)

# Setup für die Spezifikationen mit einer umfassenderen Auswahl von Variablen
specification <- setup(
  data = hardship_combined,
  y = "risktaking",  # abhängige Variable
    x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
          "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
          "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
          "HS_mh_mhhospit", "HS_sex_antiretroviral",
          "HS_original_lifeexpectancy", "HS_original_genderequality",
          "hardship_HS_index"),
  model = "lm"
)

# Zusammenfassung der Spezifikationen
summary(specification)
## Setup for the Specification Curve Analysis
## -------------------------------------------
## Class:                      specr.setup -- version: 1.0.1 
## Number of specifications:   13 
## 
## Specifications:
## 
##   Independent variable:     HS_alc_tax_wine, HS_alc_roaddeath, HS_drg_treatment, HS_nic_affordability, HS_mh_policy, HS_sex_gini, HS_oth_obesity, HS_oth_cleancooking, HS_mh_mhhospit, HS_sex_antiretroviral, HS_original_lifeexpectancy, HS_original_genderequality, hardship_HS_index 
##   Dependent variable:       risktaking 
##   Models:                   lm 
##   Covariates:               no covariates 
##   Subsets analyses:         all 
## 
## Function used to extract parameters:
## 
##   function (x) 
## broom::tidy(x, conf.int = TRUE)
## <environment: 0x30a2dc128>
## 
## 
## Head of specifications table (first 6 rows):
## # A tibble: 6 × 6
##   x                    y          model controls      subsets formula           
##   <chr>                <chr>      <chr> <chr>         <chr>   <glue>            
## 1 HS_alc_tax_wine      risktaking lm    no covariates all     risktaking ~ HS_a…
## 2 HS_alc_roaddeath     risktaking lm    no covariates all     risktaking ~ HS_a…
## 3 HS_drg_treatment     risktaking lm    no covariates all     risktaking ~ HS_d…
## 4 HS_nic_affordability risktaking lm    no covariates all     risktaking ~ HS_n…
## 5 HS_mh_policy         risktaking lm    no covariates all     risktaking ~ HS_m…
## 6 HS_sex_gini          risktaking lm    no covariates all     risktaking ~ HS_s…

run specifications

specification_results <- specr(specification)
specification_results
## Models fitted based on 13 specifications
## Number of cores used: 1 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    0.81 0.28 -0.17 2.46 0.62 0.92
summary(specification_results, digits = 5)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    2.324 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.80569 0.27765 -0.16974 2.46013 0.61842 0.91657
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  224583 224583 224583
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.917    0.0229     40.0 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.853    0.0232     36.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.784    0.0217     36.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.806    0.0227     35.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.170    0.0491     -3.46
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.837    0.0219     38.2 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

summarizing the parameter distribution

summary(specification_results, type = "curve")
## # A tibble: 1 × 7
##   median   mad    min   max   q25   q75    obs
##    <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl>  <int>
## 1  0.806 0.278 -0.170  2.46 0.618 0.917 224583
summary(specification_results, 
        type = "curve", 
        group = "x",           
        stats = c("median", "mean", "min", "max"))  # Statistiken in einem Vektor auflisten
## # A tibble: 13 × 6
##    x                          median   mean    min    max    obs
##    <chr>                       <dbl>  <dbl>  <dbl>  <dbl>  <int>
##  1 HS_alc_roaddeath            0.853  0.853  0.853  0.853 224583
##  2 HS_alc_tax_wine             0.917  0.917  0.917  0.917 224583
##  3 HS_drg_treatment            0.784  0.784  0.784  0.784 224583
##  4 HS_mh_mhhospit              0.327  0.327  0.327  0.327 224583
##  5 HS_mh_policy               -0.170 -0.170 -0.170 -0.170 224583
##  6 HS_nic_affordability        0.806  0.806  0.806  0.806 224583
##  7 HS_original_genderequality  0.677  0.677  0.677  0.677 224583
##  8 HS_original_lifeexpectancy  1.40   1.40   1.40   1.40  224583
##  9 HS_oth_cleancooking         1.09   1.09   1.09   1.09  224583
## 10 HS_oth_obesity              0.169  0.169  0.169  0.169 224583
## 11 HS_sex_antiretroviral       0.618  0.618  0.618  0.618 224583
## 12 HS_sex_gini                 0.837  0.837  0.837  0.837 224583
## 13 hardship_HS_index           2.46   2.46   2.46   2.46  224583

Plots

plot(specification_results)

(a <- plot(specification_results, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b <- plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c <- plot(specification_results, type = "samplesizes") + ylim(0, 400))

plot_grid(a, b, c, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2.5, 0.8),
          axis = "rbl")

plot(specification_results, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for males

specification_males <- setup(
  data = hardship_combined %>%
           filter(gender == 1),  # Filter for males
  y = "risktaking",
    x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
          "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
          "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
          "HS_mh_mhhospit", "HS_sex_antiretroviral",
          "HS_original_lifeexpectancy", "HS_original_genderequality",
          "hardship_HS_index"),
  model = "lm"
)

# Run the specifications for males
specification_results_males <- specr(specification_males)

# View the summary of the results
summary(specification_results_males)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.236 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min max  q25 q75
##    0.93 0.39 -0.11 2.8 0.66   1
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  119096 119096 119096
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…     0.93      0.03      29.5
## 2 HS_alc_road… risk… lm    no cova… all     riskta…     1         0.03      31.2
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…     0.83      0.03      28.6
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…     0.94      0.03      30.0
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    -0.11      0.07      -1.7
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…     0.97      0.03      32.4
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for male subset results

plot(specification_results_males)

(a_male <- plot(specification_results_males, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_male <- plot(specification_results_males, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_male <- plot(specification_results_males, type = "samplesizes") + ylim(0, 400))

plot_grid(a_male, b_male, c_male, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_males, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for females

specification_females <- setup(
  data = hardship_combined %>%
           filter(gender == 0),  # Filter for females
  y = "risktaking",
    x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
          "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
          "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
          "HS_mh_mhhospit", "HS_sex_antiretroviral",
          "HS_original_lifeexpectancy", "HS_original_genderequality",
          "hardship_HS_index"),
  model = "lm"
)

# Run the specifications for females
specification_results_females <- specr(specification_females)

# View the summary of the results
summary(specification_results_females)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.899 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    0.63 0.29 -0.26 1.96 0.51 0.83
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  105487 105487 105487
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…     0.84      0.03     25.4 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…     0.69      0.03     20.9 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…     0.7       0.03     21.8 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…     0.61      0.03     18.9 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    -0.26      0.07     -3.72
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…     0.63      0.03     20.0 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for female subset results

plot(specification_results_females)

(a_female <- plot(specification_results_females, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_female <- plot(specification_results_females, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_female <- plot(specification_results_females, type = "samplesizes") + ylim(0, 400))

plot_grid(a_female, b_female, c_female, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_females, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for age-categories

run_specification_for_age <- function(data, age_id, age_label) {
  # Daten für die spezifische Altersgruppe filtern
  data_subset <- data %>%
    filter(age_numeric == age_id)
  
  # Setup für die Spezifikationen durchführen
  specification <- setup(
    data = data_subset,
    y = "risktaking",
    x = c("HS_alc_tax_wine", "HS_alc_roaddeath", 
          "HS_drg_treatment", "HS_nic_affordability", "HS_mh_policy",
          "HS_sex_gini", "HS_oth_obesity", "HS_oth_cleancooking",
          "HS_mh_mhhospit", "HS_sex_antiretroviral",
          "HS_original_lifeexpectancy", "HS_original_genderequality",
          "hardship_HS_index"),
    model = "lm"
  )

  # Spezifikationsergebnisse berechnen
  specification_results <- specr(specification)

  # Statistische Auswertungen drucken mit Alterskategorie-Titel
  cat("\nStatistische Ergebnisse für die Alterskategorie:", age_label, "\n")
  print(summary(specification_results, digits = 5))

  # Grafiken für die spezifische Altersgruppe erzeugen und anzeigen
  plot_list <- list(
    plot_a = plot(specification_results, type = "curve", ci = FALSE, ribbon = TRUE) + 
             geom_point(size = 4) + ggtitle(paste("Curve Plot -", age_label)),
    plot_b = plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) + 
             geom_point(size = 2, shape = 4) + ggtitle(paste("Choices Plot -", age_label)),
    plot_c = plot(specification_results, type = "samplesizes") + ylim(0, 400) +
             ggtitle(paste("Sample Sizes Plot -", age_label)),
    plot_d = plot(specification_results, type = "boxplot") + 
             geom_point(alpha = .4) + scale_fill_brewer(palette = "Pastel2") + 
             labs(x = "Effect size", fill = "") + ggtitle(paste("Boxplot -", age_label))
  )

  # Rückgabe der Ergebnisse und Plots
  return(list(summary = summary(specification_results, digits = 5), plots = plot_list))
}

# Funktion für jede Altersgruppe aufrufen und sowohl statistische Zusammenfassungen als auch Plots ausgeben
for (i in 1:8) {
  results <- run_specification_for_age(hardship_combined, i, paste("Age Group", i))
  print(results$summary)  # Drucke die Zusammenfassung der Ergebnisse
  print(results$plots$plot_a)
  print(results$plots$plot_b)
  print(results$plots$plot_c)
  print(results$plots$plot_d)
}
## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 1 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.163 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad     min     max     q25     q75
##  0.89632 0.2858 0.28344 2.82099 0.70355 1.02024
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17485 17485 17485
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.912    0.0777     11.7 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.02     0.0982     10.4 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.849    0.0765     11.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.896    0.0932      9.62
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.292    0.171       1.70
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.980    0.0825     11.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.163 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad     min     max     q25     q75
##  0.89632 0.2858 0.28344 2.82099 0.70355 1.02024
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17485 17485 17485
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.912    0.0777     11.7 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.02     0.0982     10.4 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.849    0.0765     11.1 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.896    0.0932      9.62
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.292    0.171       1.70
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.980    0.0825     11.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 2 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.053 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  1.34941 0.45962 0.5492 3.96158 1.21032 1.65942
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1108 1108 1108
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.549     0.304      1.81
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.586     0.438      1.34
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    1.21      0.332      3.65
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    1.40      0.394      3.56
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.879     0.677      1.30
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    1.51      0.333      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.053 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  1.34941 0.45962 0.5492 3.96158 1.21032 1.65942
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1108 1108 1108
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.549     0.304      1.81
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.586     0.438      1.34
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    1.21      0.332      3.65
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    1.40      0.394      3.56
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.879     0.677      1.30
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    1.51      0.333      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 3 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.301 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25   q75
##  0.60445 0.38108 0.0553 1.74192 0.33074 0.686
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36643 36643 36643
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.686    0.0562     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.667    0.0608     11.0 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.604    0.0527     11.5 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.611    0.0578     10.6 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.121    0.119       1.02
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.493    0.0544      9.07
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.301 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25   q75
##  0.60445 0.38108 0.0553 1.74192 0.33074 0.686
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36643 36643 36643
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.686    0.0562     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.667    0.0608     11.0 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.604    0.0527     11.5 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.611    0.0578     10.6 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.121    0.119       1.02
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.493    0.0544      9.07
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 4 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.377 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.61579 0.27078 -0.16077 1.75112 0.31477 0.78209
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43739 43739 43739
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.709    0.0509     13.9 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.782    0.0516     15.2 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.623    0.0483     12.9 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.616    0.0494     12.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.161    0.108      -1.49
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.447    0.0492      9.09
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.377 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.61579 0.27078 -0.16077 1.75112 0.31477 0.78209
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43739 43739 43739
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.709    0.0509     13.9 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    0.782    0.0516     15.2 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.623    0.0483     12.9 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.616    0.0494     12.5 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…   -0.161    0.108      -1.49
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.447    0.0492      9.09
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 5 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.38 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.78225 0.35601 0.13038 2.55015 0.69605 1.03637
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28345 28345 28345
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.782    0.0641     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.04     0.0750     13.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.699    0.0597     11.7 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.854    0.0697     12.3 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.278    0.136       2.05
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.742    0.0632     11.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.38 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.78225 0.35601 0.13038 2.55015 0.69605 1.03637
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28345 28345 28345
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…    0.782    0.0641     12.2 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…    1.04     0.0750     13.8 
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…    0.699    0.0597     11.7 
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…    0.854    0.0697     12.3 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…    0.278    0.136       2.05
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…    0.742    0.0632     11.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 6 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.089 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max    q25     q75
##  0.95701 0.29296 0.00237 3.61082 0.9011 1.42481
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7198 7198 7198
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…  0.957       0.120   7.96   
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  0.901       0.162   5.55   
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…  0.934       0.117   7.96   
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  0.952       0.155   6.13   
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  0.00237     0.259   0.00915
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  1.42        0.136  10.5    
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.089 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max    q25     q75
##  0.95701 0.29296 0.00237 3.61082 0.9011 1.42481
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7198 7198 7198
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…  0.957       0.120   7.96   
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  0.901       0.162   5.55   
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…  0.934       0.117   7.96   
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  0.952       0.155   6.13   
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  0.00237     0.259   0.00915
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  1.42        0.136  10.5    
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 7 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.397 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min    max     q25     q75
##  0.42217 0.50127 -0.62666 1.2058 0.01638 0.59582
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50053 50053 50053
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.394     0.0479     8.22 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…   0.596     0.0440    13.6  
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.460     0.0452    10.2  
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…   0.422     0.0440     9.58 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -0.627     0.101     -6.20 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…   0.0164    0.0457     0.358
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.397 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min    max     q25     q75
##  0.42217 0.50127 -0.62666 1.2058 0.01638 0.59582
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50053 50053 50053
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.394     0.0479     8.22 
## 2 HS_alc_road… risk… lm    no cova… all     riskta…   0.596     0.0440    13.6  
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.460     0.0452    10.2  
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…   0.422     0.0440     9.58 
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -0.627     0.101     -6.20 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…   0.0164    0.0457     0.358
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 8 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.333 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max     q25      q75
##  -0.22578 0.32286 -1.21618 0.38006 -0.5408 -0.06885
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40012 40012 40012
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.380     0.0533      7.13
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  -0.0688    0.0474     -1.45
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.137     0.0492      2.79
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  -0.322     0.0497     -6.47
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -1.22      0.112     -10.9 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  -0.541     0.0512    -10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.333 sec elapsed 
##   Number of specifications:       13 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max     q25      q75
##  -0.22578 0.32286 -1.21618 0.38006 -0.5408 -0.06885
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40012 40012 40012
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 HS_alc_tax_… risk… lm    no cova… all     riskta…   0.380     0.0533      7.13
## 2 HS_alc_road… risk… lm    no cova… all     riskta…  -0.0688    0.0474     -1.45
## 3 HS_drg_trea… risk… lm    no cova… all     riskta…   0.137     0.0492      2.79
## 4 HS_nic_affo… risk… lm    no cova… all     riskta…  -0.322     0.0497     -6.47
## 5 HS_mh_policy risk… lm    no cova… all     riskta…  -1.22      0.112     -10.9 
## 6 HS_sex_gini  risk… lm    no cova… all     riskta…  -0.541     0.0512    -10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

Hardship Finance

Setup for specifications

library(specr)

# Setup für die Spezifikationen mit einer umfassenderen Auswahl von Variablen
specification <- setup(
  data = hardship_combined,
  y = "risktaking",  # abhängige Variable
    x = c("f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
          "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
          "f_original_gdp", "f_original_gini", "hardship_Finance_index"),
  model = "lm"
)

# Zusammenfassung der Spezifikationen
summary(specification)
## Setup for the Specification Curve Analysis
## -------------------------------------------
## Class:                      specr.setup -- version: 1.0.1 
## Number of specifications:   8 
## 
## Specifications:
## 
##   Independent variable:     f_inv_acctownership_primaryedu, f_oth_insfinsvcs_int, f_hs_oopexp10, f_eco_gdpdefl_linked, f_eco_cpi, f_original_gdp, f_original_gini, hardship_Finance_index 
##   Dependent variable:       risktaking 
##   Models:                   lm 
##   Covariates:               no covariates 
##   Subsets analyses:         all 
## 
## Function used to extract parameters:
## 
##   function (x) 
## broom::tidy(x, conf.int = TRUE)
## <environment: 0x13caa2ad8>
## 
## 
## Head of specifications table (first 6 rows):
## # A tibble: 6 × 6
##   x                              y          model controls      subsets formula 
##   <chr>                          <chr>      <chr> <chr>         <chr>   <glue>  
## 1 f_inv_acctownership_primaryedu risktaking lm    no covariates all     risktak…
## 2 f_oth_insfinsvcs_int           risktaking lm    no covariates all     risktak…
## 3 f_hs_oopexp10                  risktaking lm    no covariates all     risktak…
## 4 f_eco_gdpdefl_linked           risktaking lm    no covariates all     risktak…
## 5 f_eco_cpi                      risktaking lm    no covariates all     risktak…
## 6 f_original_gdp                 risktaking lm    no covariates all     risktak…

run specifications

specification_results <- specr(specification)
specification_results
## Models fitted based on 8 specifications
## Number of cores used: 1 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad  min  max  q25  q75
##    0.88 0.37 0.22 2.43 0.66 1.12
summary(specification_results, digits = 5)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.282 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min    max     q25     q75
##  0.87506 0.36897 0.22392 2.4322 0.66037 1.11566
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  225551 221536 225551
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.224    0.0218      10.3
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.506    0.0202      25.1
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.785    0.0207      38.0
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.712    0.0213      33.4
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.965    0.02        48.3
## 6 f_original_… risk… lm    no cova… all     riskta…    1.14     0.0233      49.0
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

summarizing the parameter distribution

summary(specification_results, type = "curve")
## # A tibble: 1 × 7
##   median   mad   min   max   q25   q75    obs
##    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1  0.875 0.369 0.224  2.43 0.660  1.12 225551
summary(specification_results, 
        type = "curve", 
        group = "x",           
        stats = c("median", "mean", "min", "max"))  # Statistiken in einem Vektor auflisten
## # A tibble: 8 × 6
##   x                              median  mean   min   max    obs
##   <chr>                           <dbl> <dbl> <dbl> <dbl>  <int>
## 1 f_eco_cpi                       0.965 0.965 0.965 0.965 225551
## 2 f_eco_gdpdefl_linked            0.712 0.712 0.712 0.712 221536
## 3 f_hs_oopexp10                   0.785 0.785 0.785 0.785 225551
## 4 f_inv_acctownership_primaryedu  0.224 0.224 0.224 0.224 225551
## 5 f_original_gdp                  1.14  1.14  1.14  1.14  225551
## 6 f_original_gini                 1.11  1.11  1.11  1.11  225551
## 7 f_oth_insfinsvcs_int            0.506 0.506 0.506 0.506 225551
## 8 hardship_Finance_index          2.43  2.43  2.43  2.43  225551

Plots

plot(specification_results)

(a <- plot(specification_results, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b <- plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c <- plot(specification_results, type = "samplesizes") + ylim(0, 400))

plot_grid(a, b, c, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for males

specification_males <- setup(
  data = hardship_combined %>%
           filter(gender == 1),  # Filter for males
  y = "risktaking",
    x = c("f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
          "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
          "f_original_gdp", "f_original_gini", "hardship_Finance_index"),
  model = "lm"
)

# Run the specifications for males
specification_results_males <- specr(specification_males)

# View the summary of the results
summary(specification_results_males)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.759 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median mad  min  max  q25  q75
##    0.97 0.4 0.27 2.73 0.75 1.21
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  119591 117485 119591
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…     0.27      0.03      9.14
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…     0.61      0.03     21.8 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…     0.89      0.03     31.6 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…     0.8       0.03     27.7 
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…     1.05      0.03     38.7 
## 6 f_original_… risk… lm    no cova… all     riskta…     1.3       0.03     40.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for male subset results

plot(specification_results_males)

(a_male <- plot(specification_results_males, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_male <- plot(specification_results_males, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_male <- plot(specification_results_males, type = "samplesizes") + ylim(0, 400))

plot_grid(a_male, b_male, c_male, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_males, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for females

specification_females <- setup(
  data = hardship_combined %>%
           filter(gender == 0),  # Filter for females
  y = "risktaking",
    x = c("f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
          "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
          "f_original_gdp", "f_original_gini", "hardship_Finance_index"),
  model = "lm"
)

# Run the specifications for females
specification_results_females <- specr(specification_females)

# View the summary of the results
summary(specification_results_females)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.58 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad  min  max  q25  q75
##    0.75 0.28 0.17 2.04 0.55 0.92
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  105960 104051 105960
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…     0.17      0.03      5.34
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…     0.38      0.03     13.4 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…     0.64      0.03     21.6 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…     0.61      0.03     19.4 
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…     0.86      0.03     29.5 
## 6 f_original_… risk… lm    no cova… all     riskta…     0.9       0.03     27.1 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for female subset results

plot(specification_results_females)

(a_female <- plot(specification_results_females, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_female <- plot(specification_results_females, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_female <- plot(specification_results_females, type = "samplesizes") + ylim(0, 400))

plot_grid(a_female, b_female, c_female, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_females, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for age-categories

run_specification_for_age <- function(data, age_id, age_label) {
  # Daten für die spezifische Altersgruppe filtern
  data_subset <- data %>%
    filter(age_numeric == age_id)
  
  # Setup für die Spezifikationen durchführen
  specification <- setup(
    data = data_subset,
    y = "risktaking",
    x = c("f_inv_acctownership_primaryedu", "f_oth_insfinsvcs_int",
          "f_hs_oopexp10", "f_eco_gdpdefl_linked", "f_eco_cpi",
          "f_original_gdp", "f_original_gini", "hardship_Finance_index"),
    model = "lm"
  )

  # Spezifikationsergebnisse berechnen
  specification_results <- specr(specification)

  # Statistische Auswertungen drucken mit Alterskategorie-Titel
  cat("\nStatistische Ergebnisse für die Alterskategorie:", age_label, "\n")
  print(summary(specification_results, digits = 5))

  # Grafiken für die spezifische Altersgruppe erzeugen und anzeigen
  plot_list <- list(
    plot_a = plot(specification_results, type = "curve", ci = FALSE, ribbon = TRUE) + 
             geom_point(size = 4) + ggtitle(paste("Curve Plot -", age_label)),
    plot_b = plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) + 
             geom_point(size = 2, shape = 4) + ggtitle(paste("Choices Plot -", age_label)),
    plot_c = plot(specification_results, type = "samplesizes") + ylim(0, 400) +
             ggtitle(paste("Sample Sizes Plot -", age_label)),
    plot_d = plot(specification_results, type = "boxplot") + 
             geom_point(alpha = .4) + scale_fill_brewer(palette = "Pastel2") + 
             labs(x = "Effect size", fill = "") + ggtitle(paste("Boxplot -", age_label))
  )

  # Rückgabe der Ergebnisse und Plots
  return(list(summary = summary(specification_results, digits = 5), plots = plot_list))
}

# Funktion für jede Altersgruppe aufrufen und sowohl statistische Zusammenfassungen als auch Plots ausgeben
for (i in 1:8) {
  results <- run_specification_for_age(hardship_combined, i, paste("Age Group", i))
  print(results$summary)  # Drucke die Zusammenfassung der Ergebnisse
  print(results$plots$plot_a)
  print(results$plots$plot_b)
  print(results$plots$plot_c)
  print(results$plots$plot_d)
}
## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 1 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.099 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.45447 0.49671 0.08133 1.57527 0.28547 1.05702
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17519 16909 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   0.328     0.0806      4.07
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.0813    0.0777      1.05
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.547     0.0723      7.57
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.158     0.0694      2.27
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.361     0.0621      5.82
## 6 f_original_… risk… lm    no cova… all     riskta…   0.999     0.0944     10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.099 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.45447 0.49671 0.08133 1.57527 0.28547 1.05702
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17519 16909 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   0.328     0.0806      4.07
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.0813    0.0777      1.05
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.547     0.0723      7.57
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.158     0.0694      2.27
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.361     0.0621      5.82
## 6 f_original_… risk… lm    no cova… all     riskta…   0.999     0.0944     10.6 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 2 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.03 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad   min     max     q25     q75
##  0.66806 0.44276 0.337 1.84195 0.38037 0.99122
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1110 1098 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.741     0.333      2.23
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.337     0.277      1.22
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.595     0.299      1.99
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.391     0.283      1.38
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.348     0.297      1.17
## 6 f_original_… risk… lm    no cova… all     riskta…    1.69      0.376      4.50
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.03 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad   min     max     q25     q75
##  0.66806 0.44276 0.337 1.84195 0.38037 0.99122
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1110 1098 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.741     0.333      2.23
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.337     0.277      1.22
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.595     0.299      1.99
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.391     0.283      1.38
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.348     0.297      1.17
## 6 f_original_… risk… lm    no cova… all     riskta…    1.69      0.376      4.50
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 3 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.188 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.65632 0.41376 -0.08145 1.56669 0.25407 0.81955
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36781 36047 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…  -0.0814    0.0520     -1.57
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.186     0.0515      3.60
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.835     0.0505     16.5 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.277     0.0510      5.43
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.637     0.0480     13.3 
## 6 f_original_… risk… lm    no cova… all     riskta…   0.676     0.0611     11.1 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.188 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.65632 0.41376 -0.08145 1.56669 0.25407 0.81955
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36781 36047 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…  -0.0814    0.0520     -1.57
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.186     0.0515      3.60
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.835     0.0505     16.5 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.277     0.0510      5.43
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.637     0.0480     13.3 
## 6 f_original_… risk… lm    no cova… all     riskta…   0.676     0.0611     11.1 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 4 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.245 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min  max     q25     q75
##  0.75034 0.37908 -0.15012 1.87 0.39867 0.88125
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43981 43230 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   -0.150    0.0477     -3.15
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.404    0.0453      8.93
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.870    0.0457     19.0 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.382    0.0483      7.91
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.756    0.0453     16.7 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.745    0.0529     14.1 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.245 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min  max     q25     q75
##  0.75034 0.37908 -0.15012 1.87 0.39867 0.88125
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43981 43230 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   -0.150    0.0477     -3.15
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.404    0.0453      8.93
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.870    0.0457     19.0 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.382    0.0483      7.91
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.756    0.0453     16.7 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.745    0.0529     14.1 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 5 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.149 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.65913 0.50266 0.25637 1.85024 0.31763 0.98734
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28417 27546 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.274    0.0602      4.55
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.332    0.0610      5.45
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.724    0.0579     12.5 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.256    0.0564      4.54
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.594    0.0508     11.7 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.980    0.0717     13.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.149 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.65913 0.50266 0.25637 1.85024 0.31763 0.98734
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28417 27546 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.274    0.0602      4.55
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.332    0.0610      5.45
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.724    0.0579     12.5 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.256    0.0564      4.54
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.594    0.0508     11.7 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.980    0.0717     13.7 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 6 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.054 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.57642 0.65662 -0.18088 1.69236 0.36006 1.24643
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7204 6951 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.542    0.130       4.16
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   -0.181    0.124      -1.46
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.611    0.115       5.32
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.352    0.107       3.28
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.363    0.0963      3.76
## 6 f_original_… risk… lm    no cova… all     riskta…    1.27     0.154       8.25
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.054 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.57642 0.65662 -0.18088 1.69236 0.36006 1.24643
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7204 6951 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…    0.542    0.130       4.16
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   -0.181    0.124      -1.46
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.611    0.115       5.32
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.352    0.107       3.28
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.363    0.0963      3.76
## 6 f_original_… risk… lm    no cova… all     riskta…    1.27     0.154       8.25
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 7 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.249 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min   max     q25     q75
##  0.69668 0.21201 -0.48984 1.678 0.47751 0.75062
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50291 49763 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   -0.490    0.0458    -10.7 
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.737    0.0390     18.9 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.734    0.0422     17.4 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.390    0.0470      8.29
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.659    0.0451     14.6 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.507    0.0468     10.8 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.249 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min   max     q25     q75
##  0.69668 0.21201 -0.48984 1.678 0.47751 0.75062
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50291 49763 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…   -0.490    0.0458    -10.7 
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…    0.737    0.0390     18.9 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…    0.734    0.0422     17.4 
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…    0.390    0.0470      8.29
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…    0.659    0.0451     14.6 
## 6 f_original_… risk… lm    no cova… all     riskta…    0.507    0.0468     10.8 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 8 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.198 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max      q25     q75
##  0.13241 0.23795 -0.88364 0.68027 -0.08151 0.23177
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40248 39992 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…  -0.884     0.0516   -17.1  
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.191     0.0427     4.48 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.680     0.0464    14.6  
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.0181    0.0533     0.340
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.0734    0.0525     1.40 
## 6 f_original_… risk… lm    no cova… all     riskta…  -0.380     0.052     -7.32 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.198 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max      q25     q75
##  0.13241 0.23795 -0.88364 0.68027 -0.08151 0.23177
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40248 39992 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 f_inv_accto… risk… lm    no cova… all     riskta…  -0.884     0.0516   -17.1  
## 2 f_oth_insfi… risk… lm    no cova… all     riskta…   0.191     0.0427     4.48 
## 3 f_hs_oopexp… risk… lm    no cova… all     riskta…   0.680     0.0464    14.6  
## 4 f_eco_gdpde… risk… lm    no cova… all     riskta…   0.0181    0.0533     0.340
## 5 f_eco_cpi    risk… lm    no cova… all     riskta…   0.0734    0.0525     1.40 
## 6 f_original_… risk… lm    no cova… all     riskta…  -0.380     0.052     -7.32 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

Hardship Crime

Setup for specifications

library(specr)

# Setup für die Spezifikationen mit einer umfassenderen Auswahl von Variablen
specification <- setup(
  data = hardship_combined,
  y = "risktaking",  # abhängige Variable
    x = c("c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
          "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
          "c_oth_polstab", "hardship_Crime_index"),
  model = "lm"
)

# Zusammenfassung der Spezifikationen
summary(specification)
## Setup for the Specification Curve Analysis
## -------------------------------------------
## Class:                      specr.setup -- version: 1.0.1 
## Number of specifications:   8 
## 
## Specifications:
## 
##   Independent variable:     c_bh_homicide, c_bh_childmalt, c_bh_violextchildprot, c_bh_parviolenceprog, c_bh_elderabuse, c_theft_estcorruption, c_oth_polstab, hardship_Crime_index 
##   Dependent variable:       risktaking 
##   Models:                   lm 
##   Covariates:               no covariates 
##   Subsets analyses:         all 
## 
## Function used to extract parameters:
## 
##   function (x) 
## broom::tidy(x, conf.int = TRUE)
## <environment: 0x10f912e80>
## 
## 
## Head of specifications table (first 6 rows):
## # A tibble: 6 × 6
##   x                     y          model controls      subsets formula          
##   <chr>                 <chr>      <chr> <chr>         <chr>   <glue>           
## 1 c_bh_homicide         risktaking lm    no covariates all     risktaking ~ c_b…
## 2 c_bh_childmalt        risktaking lm    no covariates all     risktaking ~ c_b…
## 3 c_bh_violextchildprot risktaking lm    no covariates all     risktaking ~ c_b…
## 4 c_bh_parviolenceprog  risktaking lm    no covariates all     risktaking ~ c_b…
## 5 c_bh_elderabuse       risktaking lm    no covariates all     risktaking ~ c_b…
## 6 c_theft_estcorruption risktaking lm    no covariates all     risktaking ~ c_t…

run specifications

specification_results <- specr(specification)
specification_results
## Models fitted based on 8 specifications
## Number of cores used: 1 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad  min  max  q25  q75
##    0.94 0.13 0.43 1.73 0.84 1.02
summary(specification_results, digits = 5)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.293 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25    q75
##  0.94298 0.13212 0.43309 1.73386 0.84391 1.0215
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  225551 225551 225551
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.947    0.0204      46.5
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    1.01     0.0221      45.7
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    1.05     0.0227      46.5
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.433    0.0222      19.5
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.939    0.0224      41.9
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.685    0.0213      32.2
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

summarizing the parameter distribution

summary(specification_results, type = "curve")
## # A tibble: 1 × 7
##   median   mad   min   max   q25   q75    obs
##    <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1  0.943 0.132 0.433  1.73 0.844  1.02 225551
summary(specification_results, 
        type = "curve", 
        group = "x",           
        stats = c("median", "mean", "min", "max"))  # Statistiken in einem Vektor auflisten
## # A tibble: 8 × 6
##   x                     median  mean   min   max    obs
##   <chr>                  <dbl> <dbl> <dbl> <dbl>  <int>
## 1 c_bh_childmalt         1.01  1.01  1.01  1.01  225551
## 2 c_bh_elderabuse        0.939 0.939 0.939 0.939 225551
## 3 c_bh_homicide          0.947 0.947 0.947 0.947 225551
## 4 c_bh_parviolenceprog   0.433 0.433 0.433 0.433 225551
## 5 c_bh_violextchildprot  1.05  1.05  1.05  1.05  225551
## 6 c_oth_polstab          0.897 0.897 0.897 0.897 225551
## 7 c_theft_estcorruption  0.685 0.685 0.685 0.685 225551
## 8 hardship_Crime_index   1.73  1.73  1.73  1.73  225551

Plots

plot(specification_results)

(a <- plot(specification_results, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b <- plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c <- plot(specification_results, type = "samplesizes") + ylim(0, 400))

plot_grid(a, b, c, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for males

specification_males <- setup(
  data = hardship_combined %>%
           filter(gender == 1),  # Filter for males
  y = "risktaking",
    x = c("c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
          "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
          "c_oth_polstab", "hardship_Crime_index"),
  model = "lm"
)

# Run the specifications for males
specification_results_males <- specr(specification_males)

# View the summary of the results
summary(specification_results_males)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.87 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad min  max  q25  q75
##    1.01 0.12 0.4 1.87 0.92 1.06
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  119591 119591 119591
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…     1.03      0.03      37.4
## 2 c_bh_childm… risk… lm    no cova… all     riskta…     1.04      0.03      34.4
## 3 c_bh_violex… risk… lm    no cova… all     riskta…     1.14      0.03      36.6
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…     0.4       0.03      13.4
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…     0.98      0.03      32.2
## 6 c_theft_est… risk… lm    no cova… all     riskta…     0.75      0.03      26.0
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for male subset results

plot(specification_results_males)

(a_male <- plot(specification_results_males, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_male <- plot(specification_results_males, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_male <- plot(specification_results_males, type = "samplesizes") + ylim(0, 400))

plot_grid(a_male, b_male, c_male, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_males, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for females

specification_females <- setup(
  data = hardship_combined %>%
           filter(gender == 0),  # Filter for females
  y = "risktaking",
    x = c("c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
          "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
          "c_oth_polstab", "hardship_Crime_index"),
  model = "lm"
)

# Run the specifications for females
specification_results_females <- specr(specification_females)

# View the summary of the results
summary(specification_results_females)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.589 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad  min  max  q25  q75
##    0.87 0.16 0.42 1.54 0.69 0.93
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  105960 105960 105960
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…     0.85      0.03      28.5
## 2 c_bh_childm… risk… lm    no cova… all     riskta…     0.93      0.03      29.1
## 3 c_bh_violex… risk… lm    no cova… all     riskta…     0.92      0.03      28.4
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…     0.42      0.03      13.0
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…     0.89      0.03      27.2
## 6 c_theft_est… risk… lm    no cova… all     riskta…     0.59      0.03      19.0
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for female subset results

plot(specification_results_females)

(a_female <- plot(specification_results_females, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_female <- plot(specification_results_females, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_female <- plot(specification_results_females, type = "samplesizes") + ylim(0, 400))

plot_grid(a_female, b_female, c_female, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_females, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for age-categories

run_specification_for_age <- function(data, age_id, age_label) {
  # Daten für die spezifische Altersgruppe filtern
  data_subset <- data %>%
    filter(age_numeric == age_id)
  
  # Setup für die Spezifikationen durchführen
  specification <- setup(
    data = data_subset,
    y = "risktaking",
    x = c("c_bh_homicide", "c_bh_childmalt", "c_bh_violextchildprot",
          "c_bh_parviolenceprog", "c_bh_elderabuse", "c_theft_estcorruption",
          "c_oth_polstab", "hardship_Crime_index"),
    model = "lm"
  )

  # Spezifikationsergebnisse berechnen
  specification_results <- specr(specification)

  # Statistische Auswertungen drucken mit Alterskategorie-Titel
  cat("\nStatistische Ergebnisse für die Alterskategorie:", age_label, "\n")
  print(summary(specification_results, digits = 5))

  # Grafiken für die spezifische Altersgruppe erzeugen und anzeigen
  plot_list <- list(
    plot_a = plot(specification_results, type = "curve", ci = FALSE, ribbon = TRUE) + 
             geom_point(size = 4) + ggtitle(paste("Curve Plot -", age_label)),
    plot_b = plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) + 
             geom_point(size = 2, shape = 4) + ggtitle(paste("Choices Plot -", age_label)),
    plot_c = plot(specification_results, type = "samplesizes") + ylim(0, 400) +
             ggtitle(paste("Sample Sizes Plot -", age_label)),
    plot_d = plot(specification_results, type = "boxplot") + 
             geom_point(alpha = .4) + scale_fill_brewer(palette = "Pastel2") + 
             labs(x = "Effect size", fill = "") + ggtitle(paste("Boxplot -", age_label))
  )

  # Rückgabe der Ergebnisse und Plots
  return(list(summary = summary(specification_results, digits = 5), plots = plot_list))
}

# Funktion für jede Altersgruppe aufrufen und sowohl statistische Zusammenfassungen als auch Plots ausgeben
for (i in 1:8) {
  results <- run_specification_for_age(hardship_combined, i, paste("Age Group", i))
  print(results$summary)  # Drucke die Zusammenfassung der Ergebnisse
  print(results$plots$plot_a)
  print(results$plots$plot_b)
  print(results$plots$plot_c)
  print(results$plots$plot_d)
}
## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 1 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.102 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.74127 0.32027 0.29083 1.16023 0.45686 0.86639
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17519 17519 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.681    0.0668     10.2 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.467    0.0778      6.00
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.899    0.0918      9.79
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.426    0.0741      5.75
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.802    0.0800     10.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.291    0.0666      4.37
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.102 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.74127 0.32027 0.29083 1.16023 0.45686 0.86639
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17519 17519 17519
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.681    0.0668     10.2 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.467    0.0778      6.00
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.899    0.0918      9.79
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.426    0.0741      5.75
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.802    0.0800     10.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.291    0.0666      4.37
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 2 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.031 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median    mad     min     max     q25     q75
##  0.5767 0.3759 0.30284 1.49943 0.36602 0.97964
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1110 1110 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.303     0.272      1.11
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.651     0.313      2.08
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    1.50      0.417      3.60
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.374     0.304      1.23
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.502     0.340      1.48
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.343     0.274      1.25
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.031 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median    mad     min     max     q25     q75
##  0.5767 0.3759 0.30284 1.49943 0.36602 0.97964
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1110 1110 1110
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.303     0.272      1.11
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.651     0.313      2.08
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    1.50      0.417      3.60
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.374     0.304      1.23
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.502     0.340      1.48
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.343     0.274      1.25
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 3 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.202 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad     min     max     q25     q75
##  0.58486 0.1632 0.22566 1.05406 0.49123 0.68449
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36781 36781 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.618    0.0489     12.6 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.552    0.0540     10.2 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.674    0.057      11.8 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.312    0.0531      5.88
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.716    0.0549     13.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.226    0.0500      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.202 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median    mad     min     max     q25     q75
##  0.58486 0.1632 0.22566 1.05406 0.49123 0.68449
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36781 36781 36781
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.618    0.0489     12.6 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.552    0.0540     10.2 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.674    0.057      11.8 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.312    0.0531      5.88
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.716    0.0549     13.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.226    0.0500      4.51
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 4 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.218 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.71825 0.26645 0.24177 1.31733 0.47367 0.82103
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43981 43981 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.803    0.0455     17.6 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.747    0.0498     15.0 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.875    0.0492     17.8 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.242    0.0492      4.91
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.689    0.0499     13.8 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.349    0.0487      7.16
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.218 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  0.71825 0.26645 0.24177 1.31733 0.47367 0.82103
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43981 43981 43981
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.803    0.0455     17.6 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.747    0.0498     15.0 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.875    0.0492     17.8 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.242    0.0492      4.91
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.689    0.0499     13.8 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.349    0.0487      7.16
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 5 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.143 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25    q75
##  0.77117 0.36329 0.3742 1.36111 0.53636 0.8775
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28417 28417 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.816    0.0536     15.2 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.572    0.0614      9.30
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.789    0.0691     11.4 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.431    0.06        7.18
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    1.06     0.0624     17.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.374    0.0538      6.96
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.143 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25    q75
##  0.77117 0.36329 0.3742 1.36111 0.53636 0.8775
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28417 28417 28417
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.816    0.0536     15.2 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.572    0.0614      9.30
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.789    0.0691     11.4 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.431    0.06        7.18
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    1.06     0.0624     17.0 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.374    0.0538      6.96
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 6 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.054 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max    q25     q75
##  0.73247 0.40732 0.34292 1.30736 0.5863 1.19524
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7204 7204 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.665     0.104      6.37
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.573     0.121      4.72
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    1.28      0.156      8.18
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.591     0.115      5.16
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.800     0.122      6.57
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.343     0.105      3.28
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.054 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max    q25     q75
##  0.73247 0.40732 0.34292 1.30736 0.5863 1.19524
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7204 7204 7204
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.665     0.104      6.37
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.573     0.121      4.72
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    1.28      0.156      8.18
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.591     0.115      5.16
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.800     0.122      6.57
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.343     0.105      3.28
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 7 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.254 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad     min     max     q25     q75
##  0.5746 0.50789 0.14662 1.05317 0.20988 0.88813
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50291 50291 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.582    0.045      12.9 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.907    0.0461     19.7 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.882    0.0440     20.1 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.175    0.0468      3.74
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.567    0.0466     12.2 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.147    0.0497      2.95
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.254 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad     min     max     q25     q75
##  0.5746 0.50789 0.14662 1.05317 0.20988 0.88813
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50291 50291 50291
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…    0.582    0.045      12.9 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…    0.907    0.0461     19.7 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…    0.882    0.0440     20.1 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…    0.175    0.0468      3.74
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…    0.567    0.0466     12.2 
## 6 c_theft_est… risk… lm    no cova… all     riskta…    0.147    0.0497      2.95
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 8 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.199 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max      q25     q75
##  -0.07542 0.27515 -0.59613 0.47786 -0.22179 0.11278
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40248 40248 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…  -0.0942    0.0500    -1.89 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…   0.478     0.0512     9.34 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…   0.381     0.0499     7.64 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…  -0.0566    0.0523    -1.08 
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…   0.0235    0.0516     0.455
## 6 c_theft_est… risk… lm    no cova… all     riskta…  -0.596     0.0559   -10.7  
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.199 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##    median     mad      min     max      q25     q75
##  -0.07542 0.27515 -0.59613 0.47786 -0.22179 0.11278
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40248 40248 40248
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 c_bh_homici… risk… lm    no cova… all     riskta…  -0.0942    0.0500    -1.89 
## 2 c_bh_childm… risk… lm    no cova… all     riskta…   0.478     0.0512     9.34 
## 3 c_bh_violex… risk… lm    no cova… all     riskta…   0.381     0.0499     7.64 
## 4 c_bh_parvio… risk… lm    no cova… all     riskta…  -0.0566    0.0523    -1.08 
## 5 c_bh_eldera… risk… lm    no cova… all     riskta…   0.0235    0.0516     0.455
## 6 c_theft_est… risk… lm    no cova… all     riskta…  -0.596     0.0559   -10.7  
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

Hardship Environment

Setup for specifications

library(specr)

# Setup für die Spezifikationen mit einer umfassenderen Auswahl von Variablen
specification <- setup(
  data = hardship_combined,
  y = "risktaking",  # abhängige Variable
    x = c("e_oth_drinkingwater",
          "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
          "e_exp_airdeath100k", "e_exp_watersanithyg", "hardship_environment_index"),
  model = "lm"
)

# Zusammenfassung der Spezifikationen
summary(specification)
## Setup for the Specification Curve Analysis
## -------------------------------------------
## Class:                      specr.setup -- version: 1.0.1 
## Number of specifications:   8 
## 
## Specifications:
## 
##   Independent variable:     e_oth_drinkingwater, e_exp_watersanithyg100k, e_ses_gini, e_ses_school, e_exp_disaster, e_exp_airdeath100k, e_exp_watersanithyg, hardship_environment_index 
##   Dependent variable:       risktaking 
##   Models:                   lm 
##   Covariates:               no covariates 
##   Subsets analyses:         all 
## 
## Function used to extract parameters:
## 
##   function (x) 
## broom::tidy(x, conf.int = TRUE)
## <environment: 0x13e1bd540>
## 
## 
## Head of specifications table (first 6 rows):
## # A tibble: 6 × 6
##   x                       y          model controls      subsets formula        
##   <chr>                   <chr>      <chr> <chr>         <chr>   <glue>         
## 1 e_oth_drinkingwater     risktaking lm    no covariates all     risktaking ~ e…
## 2 e_exp_watersanithyg100k risktaking lm    no covariates all     risktaking ~ e…
## 3 e_ses_gini              risktaking lm    no covariates all     risktaking ~ e…
## 4 e_ses_school            risktaking lm    no covariates all     risktaking ~ e…
## 5 e_exp_disaster          risktaking lm    no covariates all     risktaking ~ e…
## 6 e_exp_airdeath100k      risktaking lm    no covariates all     risktaking ~ e…

run specifications

specification_results <- specr(specification)
specification_results
## Models fitted based on 8 specifications
## Number of cores used: 1 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    1.06 0.32 -0.07 2.64 0.84 1.25
summary(specification_results, digits = 5)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    1.495 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad      min     max     q25     q75
##  1.0552 0.31972 -0.06984 2.63689 0.83561 1.24921
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  224550 224550 224550
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…   1.23      0.0253     48.6 
## 2 e_exp_water… risk… lm    no cova… all     riskta…   1.31      0.0222     59.1 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   0.941     0.0206     45.8 
## 4 e_ses_school risk… lm    no cova… all     riskta…   0.634     0.0271     23.4 
## 5 e_exp_disas… risk… lm    no cova… all     riskta…  -0.0698    0.021      -3.33
## 6 e_exp_airde… risk… lm    no cova… all     riskta…   1.17      0.0215     54.4 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

summarizing the parameter distribution

summary(specification_results, type = "curve")
## # A tibble: 1 × 7
##   median   mad     min   max   q25   q75    obs
##    <dbl> <dbl>   <dbl> <dbl> <dbl> <dbl>  <dbl>
## 1   1.06 0.320 -0.0698  2.64 0.836  1.25 224550
summary(specification_results, 
        type = "curve", 
        group = "x",           
        stats = c("median", "mean", "min", "max"))  # Statistiken in einem Vektor auflisten
## # A tibble: 8 × 6
##   x                           median    mean     min     max    obs
##   <chr>                        <dbl>   <dbl>   <dbl>   <dbl>  <int>
## 1 e_exp_airdeath100k          1.17    1.17    1.17    1.17   224550
## 2 e_exp_disaster             -0.0698 -0.0698 -0.0698 -0.0698 224550
## 3 e_exp_watersanithyg         0.903   0.903   0.903   0.903  224550
## 4 e_exp_watersanithyg100k     1.31    1.31    1.31    1.31   224550
## 5 e_oth_drinkingwater         1.23    1.23    1.23    1.23   224550
## 6 e_ses_gini                  0.941   0.941   0.941   0.941  224550
## 7 e_ses_school                0.634   0.634   0.634   0.634  224550
## 8 hardship_environment_index  2.64    2.64    2.64    2.64   224550

Plots

plot(specification_results)

(a <- plot(specification_results, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b <- plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c <- plot(specification_results, type = "samplesizes") + ylim(0, 400))

plot_grid(a, b, c, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for males

specification_males <- setup(
  data = hardship_combined %>%
           filter(gender == 1),  # Filter for males
  y = "risktaking",
    x = c("e_oth_drinkingwater",
          "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
          "e_exp_airdeath100k", "e_exp_watersanithyg", "hardship_environment_index"),
  model = "lm"
)

# Run the specifications for males
specification_results_males <- specr(specification_males)

# View the summary of the results
summary(specification_results_males)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.747 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    1.16 0.41 -0.05 2.96 0.96 1.42
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  119093 119093 119093
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…     1.41      0.04     39.8 
## 2 e_exp_water… risk… lm    no cova… all     riskta…     1.46      0.03     48.1 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…     1.04      0.03     37.3 
## 4 e_ses_school risk… lm    no cova… all     riskta…     0.72      0.04     18.8 
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    -0.05      0.03     -1.62
## 6 e_exp_airde… risk… lm    no cova… all     riskta…     1.28      0.03     43.5 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for male subset results

plot(specification_results_males)

(a_male <- plot(specification_results_males, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_male <- plot(specification_results_males, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_male <- plot(specification_results_males, type = "samplesizes") + ylim(0, 400))

plot_grid(a_male, b_male, c_male, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_males, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for females

specification_females <- setup(
  data = hardship_combined %>%
           filter(gender == 0),  # Filter for females
  y = "risktaking",
    x = c("e_oth_drinkingwater",
          "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
          "e_exp_airdeath100k", "e_exp_watersanithyg", "hardship_environment_index"),
  model = "lm"
)

# Run the specifications for females
specification_results_females <- specr(specification_females)

# View the summary of the results
summary(specification_results_females)
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.676 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median  mad   min  max  q25  q75
##    0.88 0.31 -0.14 2.11 0.62 1.02
## 
## Descriptive summary of sample sizes: 
## 
##  median    min    max
##  105457 105457 105457
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…     0.96      0.04     27.0 
## 2 e_exp_water… risk… lm    no cova… all     riskta…     1.07      0.03     33.5 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…     0.8       0.03     26.5 
## 4 e_ses_school risk… lm    no cova… all     riskta…     0.51      0.04     13.2 
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    -0.14      0.03     -4.63
## 6 e_exp_airde… risk… lm    no cova… all     riskta…     1         0.03     32.2 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>

Plots for female subset results

plot(specification_results_females)

(a_female <- plot(specification_results_females, type = "curve", ci = F, ribbon = T) + 
   geom_point(size = 4))

(b_female <- plot(specification_results_females, type = "choices", choices = c("x", "y", "model", "controls")) +
   geom_point(size = 2, shape = 4)) 

(c_female <- plot(specification_results_females, type = "samplesizes") + ylim(0, 400))

plot_grid(a_female, b_female, c_female, ncol = 1,
          align = "v",
          rel_heights = c(1.5, 2, 0.8),
          axis = "rbl")

plot(specification_results_females, type = "boxplot") + 
  geom_point(alpha = .4) + 
  scale_fill_brewer(palette = "Pastel2") +
  labs(x = "Effect size", fill = "")

Subsetting data for age-categories

run_specification_for_age <- function(data, age_id, age_label) {
  # Daten für die spezifische Altersgruppe filtern
  data_subset <- data %>%
    filter(age_numeric == age_id)
  
  # Setup für die Spezifikationen durchführen
  specification <- setup(
    data = data_subset,
    y = "risktaking",
    x = c("e_oth_drinkingwater",
          "e_exp_watersanithyg100k", "e_ses_gini", "e_ses_school", "e_exp_disaster", 
          "e_exp_airdeath100k", "e_exp_watersanithyg", "hardship_environment_index"),
    model = "lm"
  )

  # Spezifikationsergebnisse berechnen
  specification_results <- specr(specification)

  # Statistische Auswertungen drucken mit Alterskategorie-Titel
  cat("\nStatistische Ergebnisse für die Alterskategorie:", age_label, "\n")
  print(summary(specification_results, digits = 5))

  # Grafiken für die spezifische Altersgruppe erzeugen und anzeigen
  plot_list <- list(
    plot_a = plot(specification_results, type = "curve", ci = FALSE, ribbon = TRUE) + 
             geom_point(size = 4) + ggtitle(paste("Curve Plot -", age_label)),
    plot_b = plot(specification_results, type = "choices", choices = c("x", "y", "model", "controls")) + 
             geom_point(size = 2, shape = 4) + ggtitle(paste("Choices Plot -", age_label)),
    plot_c = plot(specification_results, type = "samplesizes") + ylim(0, 400) +
             ggtitle(paste("Sample Sizes Plot -", age_label)),
    plot_d = plot(specification_results, type = "boxplot") + 
             geom_point(alpha = .4) + scale_fill_brewer(palette = "Pastel2") + 
             labs(x = "Effect size", fill = "") + ggtitle(paste("Boxplot -", age_label))
  )

  # Rückgabe der Ergebnisse und Plots
  return(list(summary = summary(specification_results, digits = 5), plots = plot_list))
}

# Funktion für jede Altersgruppe aufrufen und sowohl statistische Zusammenfassungen als auch Plots ausgeben
for (i in 1:8) {
  results <- run_specification_for_age(hardship_combined, i, paste("Age Group", i))
  print(results$summary)  # Drucke die Zusammenfassung der Ergebnisse
  print(results$plots$plot_a)
  print(results$plots$plot_b)
  print(results$plots$plot_c)
  print(results$plots$plot_d)
}
## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 1 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.1 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.00315 0.74203 0.06936 2.46486 0.57135 1.47138
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17471 17471 17471
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…   1.94      0.146      13.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…   1.31      0.0877     15.0 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   1.05      0.0733     14.4 
## 4 e_ses_school risk… lm    no cova… all     riskta…   0.365     0.158       2.31
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   0.0694    0.0614      1.13
## 6 e_exp_airde… risk… lm    no cova… all     riskta…   0.640     0.0738      8.67
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.1 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.00315 0.74203 0.06936 2.46486 0.57135 1.47138
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   17471 17471 17471
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…   1.94      0.146      13.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…   1.31      0.0877     15.0 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   1.05      0.0733     14.4 
## 4 e_ses_school risk… lm    no cova… all     riskta…   0.365     0.158       2.31
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   0.0694    0.0614      1.13
## 6 e_exp_airde… risk… lm    no cova… all     riskta…   0.640     0.0738      8.67
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 2 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.031 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.42662 1.06436 0.16285 3.62138 0.80264 2.14885
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1109 1109 1109
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    3.12      0.570     5.47 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    1.77      0.357     4.98 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.521     0.299     1.74 
## 4 e_ses_school risk… lm    no cova… all     riskta…    1.08      0.562     1.92 
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    0.163     0.247     0.660
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.897     0.299     3.00 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.031 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.42662 1.06436 0.16285 3.62138 0.80264 2.14885
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    1109 1109 1109
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    3.12      0.570     5.47 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    1.77      0.357     4.98 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.521     0.299     1.74 
## 4 e_ses_school risk… lm    no cova… all     riskta…    1.08      0.562     1.92 
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    0.163     0.247     0.660
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.897     0.299     3.00 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 3 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.18 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  0.67373 0.20809 -0.263 1.66122 0.64445 0.91915
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36596 36596 36596
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.902    0.0775     11.6 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.971    0.0578     16.8 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.652    0.0506     12.9 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.621    0.0774      8.03
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.263    0.0488     -5.39
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.678    0.0525     12.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.18 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad    min     max     q25     q75
##  0.67373 0.20809 -0.263 1.66122 0.64445 0.91915
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   36596 36596 36596
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.902    0.0775     11.6 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.971    0.0578     16.8 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.652    0.0506     12.9 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.621    0.0774      8.03
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.263    0.0488     -5.39
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.678    0.0525     12.9 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 4 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.249 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad      min     max    q25     q75
##  0.7772 0.25192 -0.26951 1.83427 0.5977 0.92031
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43722 43722 43722
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.904    0.0590     15.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.971    0.0508     19.1 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.745    0.0458     16.2 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.498    0.0593      8.41
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.270    0.0480     -5.61
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.810    0.0491     16.5 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.249 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##  median     mad      min     max    q25     q75
##  0.7772 0.25192 -0.26951 1.83427 0.5977 0.92031
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   43722 43722 43722
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.904    0.0590     15.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.971    0.0508     19.1 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.745    0.0458     16.2 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.498    0.0593      8.41
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.270    0.0480     -5.61
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.810    0.0491     16.5 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 5 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.251 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.82666 0.36223 -0.06869 2.10444 0.74042 1.22555
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28300 28300 28300
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…   1.53      0.0991     15.4 
## 2 e_exp_water… risk… lm    no cova… all     riskta…   1.12      0.0674     16.7 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   0.856     0.0579     14.8 
## 4 e_ses_school risk… lm    no cova… all     riskta…   0.635     0.102       6.21
## 5 e_exp_disas… risk… lm    no cova… all     riskta…  -0.0687    0.0523     -1.31
## 6 e_exp_airde… risk… lm    no cova… all     riskta…   0.775     0.0581     13.3 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.251 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.82666 0.36223 -0.06869 2.10444 0.74042 1.22555
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   28300 28300 28300
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…   1.53      0.0991     15.4 
## 2 e_exp_water… risk… lm    no cova… all     riskta…   1.12      0.0674     16.7 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   0.856     0.0579     14.8 
## 4 e_ses_school risk… lm    no cova… all     riskta…   0.635     0.102       6.21
## 5 e_exp_disas… risk… lm    no cova… all     riskta…  -0.0687    0.0523     -1.31
## 6 e_exp_airde… risk… lm    no cova… all     riskta…   0.775     0.0581     13.3 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 6 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.077 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.19034 0.62619 0.15242 2.95996 0.80354 1.67544
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7193 7193 7193
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    2.45     0.250       9.78
## 2 e_exp_water… risk… lm    no cova… all     riskta…    1.41     0.139      10.2 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.967    0.115       8.42
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.697    0.276       2.53
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    0.152    0.0935      1.63
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.839    0.117       7.17
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.077 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad     min     max     q25     q75
##  1.19034 0.62619 0.15242 2.95996 0.80354 1.67544
## 
## Descriptive summary of sample sizes: 
## 
##  median  min  max
##    7193 7193 7193
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    2.45     0.250       9.78
## 2 e_exp_water… risk… lm    no cova… all     riskta…    1.41     0.139      10.2 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.967    0.115       8.42
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.697    0.276       2.53
## 5 e_exp_disas… risk… lm    no cova… all     riskta…    0.152    0.0935      1.63
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.839    0.117       7.17
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 7 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.278 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.67314 0.22178 -0.14896 1.59072 0.38994 0.76119
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50028 50028 50028
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.675    0.0442     15.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.760    0.0449     16.9 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.671    0.0426     15.8 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.164    0.0492      3.33
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.149    0.0477     -3.12
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.764    0.0477     16.0 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.278 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##   median     mad      min     max     q25     q75
##  0.67314 0.22178 -0.14896 1.59072 0.38994 0.76119
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   50028 50028 50028
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…    0.675    0.0442     15.3 
## 2 e_exp_water… risk… lm    no cova… all     riskta…    0.760    0.0449     16.9 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…    0.671    0.0426     15.8 
## 4 e_ses_school risk… lm    no cova… all     riskta…    0.164    0.0492      3.33
## 5 e_exp_disas… risk… lm    no cova… all     riskta…   -0.149    0.0477     -3.12
## 6 e_exp_airde… risk… lm    no cova… all     riskta…    0.764    0.0477     16.0 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL

## 
## Statistische Ergebnisse für die Alterskategorie: Age Group 8 
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.208 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##    median    mad      min     max      q25      q75
##  -0.11647 0.0701 -0.31557 0.20319 -0.15517 -0.08139
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40131 40131 40131
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…  -0.147     0.0490    -2.99 
## 2 e_exp_water… risk… lm    no cova… all     riskta…  -0.100     0.0498    -2.01 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   0.203     0.0464     4.38 
## 4 e_ses_school risk… lm    no cova… all     riskta…  -0.0342    0.0508    -0.673
## 5 e_exp_disas… risk… lm    no cova… all     riskta…  -0.316     0.0528    -5.98 
## 6 e_exp_airde… risk… lm    no cova… all     riskta…  -0.181     0.0536    -3.38 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL
## Results of the specification curve analysis
## -------------------
## Technical details:
## 
##   Class:                          specr.object -- version: 1.0.1 
##   Cores used:                     1 
##   Duration of fitting process:    0.208 sec elapsed 
##   Number of specifications:       8 
## 
## Descriptive summary of the specification curve:
## 
##    median    mad      min     max      q25      q75
##  -0.11647 0.0701 -0.31557 0.20319 -0.15517 -0.08139
## 
## Descriptive summary of sample sizes: 
## 
##  median   min   max
##   40131 40131 40131
## 
## Head of the specification results (first 6 rows): 
## 
## # A tibble: 6 × 24
##   x            y     model controls subsets formula estimate std.error statistic
##   <chr>        <chr> <chr> <chr>    <chr>   <glue>     <dbl>     <dbl>     <dbl>
## 1 e_oth_drink… risk… lm    no cova… all     riskta…  -0.147     0.0490    -2.99 
## 2 e_exp_water… risk… lm    no cova… all     riskta…  -0.100     0.0498    -2.01 
## 3 e_ses_gini   risk… lm    no cova… all     riskta…   0.203     0.0464     4.38 
## 4 e_ses_school risk… lm    no cova… all     riskta…  -0.0342    0.0508    -0.673
## 5 e_exp_disas… risk… lm    no cova… all     riskta…  -0.316     0.0528    -5.98 
## 6 e_exp_airde… risk… lm    no cova… all     riskta…  -0.181     0.0536    -3.38 
## # ℹ 15 more variables: p.value <dbl>, conf.low <dbl>, conf.high <dbl>,
## #   fit_r.squared <dbl>, fit_adj.r.squared <dbl>, fit_sigma <dbl>,
## #   fit_statistic <dbl>, fit_p.value <dbl>, fit_df <dbl>, fit_logLik <dbl>,
## #   fit_AIC <dbl>, fit_BIC <dbl>, fit_deviance <dbl>, fit_df.residual <dbl>,
## #   fit_nobs <dbl>
## NULL